import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons'
import VueLazyload from 'vue-lazyload'

// set ElementUI lang to EN
Vue.use(ElementUI)
Vue.use(VueLazyload)
// 如果想要中文版 element-ui，按如下方式声明
// Vue.use(ElementUI)

const loadimage = require('./assets/image/jiance.png')
const errorimage = require('./assets/image/niu.png')

Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: errorimage,
  loading: loadimage,
  attempt: 1
})

Vue.config.productionTip = false

import dataV from '@jiaminghi/data-view'
Vue.use(dataV)

import geoJson from '@/utils/china.json'
echarts.registerMap('china', geoJson)
import scroll from 'vue-seamless-scroll'
Vue.use(scroll)
import * as echarts from 'echarts'
import 'echarts-gl'
Vue.prototype.$echarts = echarts
import ECharts from 'vue-echarts'
Vue.component('v-chart', ECharts)
Vue.config.productionTip = false
import Moment from 'moment'
Vue.prototype.$moment = Moment
// echart 字体大小适配
window.nowSize = (val, initWidth = 1920) => {
  const nowClientWidth = document.documentElement.clientWidth
  return val * (nowClientWidth / initWidth)
}
window.nowSizeH = (val, initHeight = 1080) => {
  const nowClientHeight = document.documentElement.clientHeight
  return val * (nowClientHeight / initHeight)
}

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
